package com.wandian.audio.adapter;


import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.makeramen.roundedimageview.RoundedImageView;
import com.mylib.libcore.utils.GlideUtil;
import com.mylib.libcore.utils.UIUtils;
import com.wandian.audio.R;
import com.wandian.audio.bean.MusicTopRankListBean;

/**
 * AudioTopRankDetailRecycleAdapter-适配器
 */
public class AudioTopRankDetailRecycleAdapter extends BaseQuickAdapter<MusicTopRankListBean.PlaylistEntity.TracksEntity, BaseViewHolder> {

    public AudioTopRankDetailRecycleAdapter(int layoutResId) {
        super(layoutResId);
    }


    @Override
    protected void convert(BaseViewHolder helper, MusicTopRankListBean.PlaylistEntity.TracksEntity item) {
        RoundedImageView iv_music_bg = helper.getView(R.id.iv_music_bg);
        if(!UIUtils.isEmpty(item.getAl())){
            GlideUtil.into(mContext,item.getAl().getPicUrl(),iv_music_bg);
        }
        if(!UIUtils.isEmpty(item.getAr()) && item.getAr().size()>0){
            if(UIUtils.isEmpty(item.getAr().get(0).getName())){
                helper.setText(R.id.tv_music_author,  "未知");
            }else {
                helper.setText(R.id.tv_music_author, item.getAr().get(0).getName()+"");
            }
        }

        helper.setText(R.id.tv_music_name, item.getName()+"");

    }

}
